/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Daniel Cruz
 */
@Embeddable
public class ReservaPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 15)
    @Column(name = "volumen_id")
    private String volumenId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "num_ejemplar")
    private int numEjemplar;
    @Basic(optional = false)
    @NotNull
    @Column(name = "res_id")
    private long resId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 15)
    @Column(name = "prs_identificacion")
    private String prsIdentificacion;

    public ReservaPK() {
    }

    public ReservaPK(String volumenId, int numEjemplar, long resId, String prsIdentificacion) {
        this.volumenId = volumenId;
        this.numEjemplar = numEjemplar;
        this.resId = resId;
        this.prsIdentificacion = prsIdentificacion;
    }

    public String getVolumenId() {
        return volumenId;
    }

    public void setVolumenId(String volumenId) {
        this.volumenId = volumenId;
    }

    public int getNumEjemplar() {
        return numEjemplar;
    }

    public void setNumEjemplar(int numEjemplar) {
        this.numEjemplar = numEjemplar;
    }

    public long getResId() {
        return resId;
    }

    public void setResId(long resId) {
        this.resId = resId;
    }

    public String getPrsIdentificacion() {
        return prsIdentificacion;
    }

    public void setPrsIdentificacion(String prsIdentificacion) {
        this.prsIdentificacion = prsIdentificacion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (volumenId != null ? volumenId.hashCode() : 0);
        hash += (int) numEjemplar;
        hash += (int) resId;
        hash += (prsIdentificacion != null ? prsIdentificacion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ReservaPK)) {
            return false;
        }
        ReservaPK other = (ReservaPK) object;
        if ((this.volumenId == null && other.volumenId != null) || (this.volumenId != null && !this.volumenId.equals(other.volumenId))) {
            return false;
        }
        if (this.numEjemplar != other.numEjemplar) {
            return false;
        }
        if (this.resId != other.resId) {
            return false;
        }
        if ((this.prsIdentificacion == null && other.prsIdentificacion != null) || (this.prsIdentificacion != null && !this.prsIdentificacion.equals(other.prsIdentificacion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.ReservaPK[ volumenId=" + volumenId + ", numEjemplar=" + numEjemplar + ", resId=" + resId + ", prsIdentificacion=" + prsIdentificacion + " ]";
    }
    
}
